﻿namespace WMS6.Web.CustomizeReport
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class TNTInOutStockInvRptQuery : BasePage
    {
        protected Button btnSearch;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlSkuClassID;
        protected DropDownList ddlSkuDescr;
        protected DropDownList ddlSkuGroup;
        protected DropDownList ddlSkuID;
        protected HtmlForm F16020;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlHead Head1;
        protected Label lblEndDateTime;
        protected Label lblOwnerID;
        protected Label lblSkuClassID;
        protected Label lblSkuDescr;
        protected Label lblSkuGroup;
        protected Label lblSkuID;
        protected Label lblStartDateTime;
        protected HtmlLink mycss;
        protected Label one1;
        protected TextBox txtEndDateTime;
        protected TextBox txtOwnerID;
        protected TextBox txtSkuClassID;
        protected TextBox txtSkuDescr;
        protected TextBox txtSkuGroup;
        protected TextBox txtSkuID;
        protected TextBox txtStartDateTime;

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("TNTInOutStockInvRptList.aspx", false);
        }

        private void InitDropDownLists()
        {
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlSkuGroup, 0);
            base.InitQueryDDL(this.ddlSkuClassID, 0);
            base.InitQueryDDL(this.ddlSkuID, 0);
            base.InitQueryDDL(this.ddlSkuDescr, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.InitDropDownLists();
            }
        }

        public string Descr
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuDescr.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuDescr.Text.Trim(), this.ddlSkuDescr.SelectedValue);
                }
                return "";
            }
        }

        public string EndTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEndDateTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtEndDateTime.Text).ToString("yyyy-MM-dd") + " 23:59:59");
                }
                return (DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59");
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string SkuClassID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuClassID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuClassID.Text.Trim(), this.ddlSkuClassID.SelectedValue);
                }
                return "";
            }
        }

        public string SkuGroup
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuGroup.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuGroup.Text.Trim(), this.ddlSkuGroup.SelectedValue);
                }
                return "";
            }
        }

        public string SkuID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuID.Text.Trim(), this.ddlSkuID.SelectedValue);
                }
                return "";
            }
        }

        public string StartTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtStartDateTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtStartDateTime.Text).ToString("yyyy-MM-dd") + " 00:00:00");
                }
                return (DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
            }
        }
    }
}

